"""MxOnline URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path, include
from django.views.generic import TemplateView
from django.views.static import serve
import xadmin
from users import views
from organization import views as org_vews
from .settings import MEDIA_ROOT

urlpatterns = [
    # path(r'admin/', admin.site.urls),
    path('xadmin/', xadmin.site.urls),
    path('', TemplateView.as_view(template_name='index.html'), name='index'),
    path('index/', TemplateView.as_view(template_name='index.html'), name='index'),
    path('login/', views.LoginView.as_view(), name='login'),
    path('logout/', views.LogoutView.as_view(), name='logout'),
    path('rigister/', views.RegisterView.as_view(), name='register'),
    path('forgetpwd/', views.ForgetPwdView.as_view(),
         name='forgetpwd'),
    path('modify_pwd/', views.ModifyPwdView.as_view(), name='modify_pwd'),
    path('captcha/', include('captcha.urls'), name='captcha'),
    re_path('active/(?P<active_code>.*)/',
            views.ActiveUserView.as_view(), name='active'),
    re_path('reset/(?P<active_code>.*)/',
            views.ActiveUserView.as_view(), name='reset_pwd'),
    path('org_list/', org_vews.OrgView.as_view(), name='org_list'),
    # 配置上传文件的访问处理函数
    re_path('media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}),
]
